#include "CListAnswer.h"

CListAnswer::CListAnswer() {
	// "Not yet implemented";
}

CAnswer CListAnswer::getAnswer(const int n)
{
    if (n < this->answers.count())
	return this->answers[n];
    return CAnswer();
}

CAnswer CListAnswer::lastAnswer() const
{
    if (!answers.isEmpty())
	return answers.last();
    return CAnswer();
}

int CListAnswer::lastIndex() const
{
    if (!answers.isEmpty())
	return answers.count()-1;
    return -1;
}

int CListAnswer::addAnswer(const CAnswer answer)
{
    this->answers.append(answer);
    return this->answers.count()-1;
}

bool CListAnswer::updateAnswer(const CAnswer answer, int n)
{
    if (n < this->answers.count())
	this->answers.replace(n, answer);
    return true;
}

bool CListAnswer::deleteAnswer(const int n)
{
    if (n < this->answers.count())
	this->answers.remove(n);
    return true;
}

int CListAnswer::count() const
{
    return this->answers.count();
}
